package com.sdx.console.promote.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.promote.dao.ChannelAuthorizationDao;
import com.sdx.console.promote.entity.ChannelAuthorization;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 邀请码 Service
 */

@Service
@Transactional
public class ChannelAuthorizationService extends BaseService<ChannelAuthorization>{

    @Resource
	private ChannelAuthorizationDao channelAuthorizationDao;

    public PageQuery<ChannelAuthorization>queryByCondition(PageQuery query){
        PageQuery ret =  channelAuthorizationDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelChannelAuthorization(List<String> ids){
        try {
            channelAuthorizationDao.batchDelChannelAuthorizationByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除邀请码失败", e);
        }
    }

	public List<ChannelAuthorization> all() {
		return channelAuthorizationDao.all();
		}
}